
$(document).ready(function () {
/*™*******************************************************************************************™*/

	 $( "#BTTnewrow" ).click(function() {

    	
		var num_row = $("#HIDnum_row").val();


		num_row = parseFloat(num_row) + parseFloat(1);
		$("#HIDnum_row").val(num_row);
		

		 

        

		$("<p><label for='province'>province:</label></p><p><?php echo $province; ?> <label for='district'>district:</label><div id='citydiv'><select class='form-control' name='district' id='district'><option value=''>------Please Select-------</option></select></div></p>").insertBefore("#addNewRow");
			
		


    });


});
 






	function getXMLHTTP() { //fuction to return the xml http object
        var xmlhttp=false;    
        try{
            xmlhttp=new XMLHttpRequest();
        }
        catch(e)    {        
            try{            
                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                req = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp=false;
                }
            }
        }

        return xmlhttp;
    }


    function getcate(strURL)
    {       
 
     var req = getXMLHTTP(); // fuction to get xmlhttp object
     if (req)
     {
      req.onreadystatechange = function()
     {
      if (req.readyState == 4) { //data is retrieved from server
       if (req.status == 200) { // which reprents ok status                    
         document.getElementById('citydiv').innerHTML=req.responseText;
      }
      else
      { 
         alert("There was a problem while using XMLHTTP:\n");
      }
      }            
      }        
    req.open("GET", strURL, true); //open url using get method
    req.send(null);
     }
    }


    function getcateadd(strURL)
    {   
    	var function_name = "gatcateadd1";
		 
		// Since its name is being dynamically generated, always ensure your function actually exists
				if (typeof(window[function_name]) === "function")
				{
					window[function_name](strURL,numrow);
				}
				else
				{
					throw("Error.  Function " + function_name + " does not exist.");
				}

				   function getcateadd(strURL)
				    { 
            
		     var req = getXMLHTTP(); // fuction to get xmlhttp object
		     if (req)
		     {
		      req.onreadystatechange = function()
		     {
		      if (req.readyState == 4) { //data is retrieved from server
		       if (req.status == 200) { // which reprents ok status                    
		         document.getElementById('citydiv'+numrow).innerHTML=req.responseText;
		      }
		      else
		      { 
		         alert("There was a problem while using XMLHTTP:\n");
		      }
		      }            
		      }        
		    req.open("GET", strURL, true); //open url using get method
		    req.send(null);
		     }
			 }
		    }

   
    

